package com.wbw.ssb.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author: guibo
 * @Description:
 * @Date: Created in 1:29 2021/5/19
 * @Modified By:
 */
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {

    @Bean(value = "openApi3.0")
    public Docket defaultApi2() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .description("# 智慧粮仓 RESTful APIs")
                        .termsOfServiceUrl("http://www.wangbowen.cn")
                        .contact(new Contact("黄贵波","http://www.wangbowen.cn","838912974@qq.com"))
                        .version("1.0")
                        .build())
                .groupName("智慧粮仓API")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.wbw.ssb.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}
